package com.corpgovernment.common.apollo;

import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 网关阿波罗配置映射实体
 *
 * @author yh_yin
 */
@Getter
@Component
public class GatewayApollo extends CommonApollo {

    /**
     * 用户权限不校验url
     */
    @Value("${userPermissionIgnoreCheckUrl:}")
    private String userPermissionIgnoreCheckUrl;
    /**
     * 不校验的url，多个使用 | 隔开
     */
    @Value("${ignoreCheckUrl:}")
    private String ignoreCheckUrl;

    @Value("${notIgnoreCheckUrl:}")
    private String notIgnoreCheckUrl;

    /**
     * 脚本注入校验白名单
     */
    @Value("${xssIgnoreCheckUrl:}")
    private String xssIgnoreCheckUrl;

    @Value("${submenuKey:{\"/orgStructure\":\"/orgStructure/position,/orgStructure/paySetting,/orgStructure/setting\",\"/reconciliationSettlement/enterpriseReconciliation\":\"/reconciliationSettlement/car,/reconciliationSettlement/flight,/reconciliationSettlement/hotel,/reconciliationSettlement/train\"}}")
    private String submenuKey;

    @Value("${needSetDefaultClientIdUrl:}")
    private String needSetDefaultClientIdUrl;

    @Value("${defaultClientId:}")
    private String defaultClientId;

    public String getDefaultClientId() {
        return getAppProperty("defaultClientId", "");
    }

    public String getNeedSetDefaultClientIdUrl() {
        return getAppProperty("needSetDefaultClientIdUrl", "");
    }

    public String getNotIgnoreCheckUrl() {
        return getAppProperty("notIgnoreCheckUrl", "");
    }

    public String getUserPermissionIgnoreCheckUrl() {
        return getAppProperty("userPermissionIgnoreCheckUrl", "");
    }

    public String getIgnoreCheckUrl() {
        return getAppProperty("ignoreCheckUrl", "");
    }

    public String getXssIgnoreCheckUrl() {
        return getAppProperty("xssIgnoreCheckUrl", "");
    }
}
